package com.amos.base.util;

import com.amos.base.base.Result;

/**
 * @author Amos
 * @ClassName ResultWapper
 * @Description 返回结果封装类
 * @Date 2018/12/22 23:27
 * @VERSION 1.0
 **/
public class ResultWapper {
    /**
     * 返回正确的结果
     * @return
     */
    public static Result SUCCESS(){
        return new Result.Builder(Result.SUCCESS).msg(Result.DEFAULT_SUCCESS_MSG).builder();
    }
    /**
     * 返回正确的结果 返回数据
     * @return
     */
    public static Result SUCCESS(Object data){
        return new Result.Builder(Result.SUCCESS).msg(Result.DEFAULT_SUCCESS_MSG).data(data).builder();
    }

    /**
     * 验证失败 返回错误信息
     * @param msg
     * @return
     */
    public static Result FAIL(String msg){
        return new Result.Builder(Result.VALIDATEERROR).msg(msg).builder();
    }

    /**
     * 系统错误 返回异常信息
     * @param msg
     * @return
     */
    public static Result ERROR(String msg){
        return new Result.Builder(Result.ERROR).msg(msg).builder();
    }

    /**
     * 系统错误
     * @return
     */
    public static Result ERROR(){
        return new Result.Builder(Result.ERROR).msg(Result.DEFAULT_ERROR_MSG).builder();
    }
}
